var img = document.getElementsByTagName("img");
function lazy(entries) {
  for (let i of entries) {
    if (i.isIntersecting) {
      let imgs = i.target;
      let positionSrc = imgs.getAttribute("src");
      if (positionSrc === "/images/defaultimg.png") {
        let trueSrc = imgs.getAttribute("data-src");
        imgs.setAttribute("src", trueSrc);
        observer.unobserve(imgs);
      }
    }
  }
}
const observer = new IntersectionObserver(lazy);
for (let i of img) {
  observer.observe(i);
}
